Skip to content

feat(workbench): effect-atom phase-1 pilot — Agent Document panel on @effect/atom-react under a root RegistryProvider (#105) - #250

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
feat/workbench-atom-pilot
Sep 2, 2026
Merged

feat(workbench): effect-atom phase-1 pilot — Agent Document panel on @effect/atom-react under a root RegistryProvider (#105)#250
ScriptedAlchemy merged 1 commit into
mainfrom
feat/workbench-atom-pilot

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Phase 1 of the effect-atom pilot for the Workbench (#105), per the completed evaluation.

  • Mounts one root RegistryProvider in the Workbench app shell (main.tsx); the module-level default registry is never used.
  • Migrates RuntimeDocumentPanel's hand-rolled request state (manual request union, AbortController, stale-run guards) to an Atom.family keyed by run id in a dedicated browser-state module (src/runtime/agent-document-atoms.ts). Atoms consume the existing strictly-decoded agent-document-client.ts output; the zod decoders and ProjectClient/RuntimeClient lifecycles are untouched. Effect.tryPromise maps fiber interruption to the request AbortSignal, so unmount/dispose aborts in-flight loads structurally.
  • Exact pins synchronized with the repo's effect pin: effect@4.0.0-rc.112, @effect/atom-react@4.0.0-rc.112, scheduler@0.27.0. No legacy @effect-atom/* packages. No stream-backed derived atoms (rc.112 disposal bug — fixed upstream post-rc.112, unpublished).
  • Adds the Workbench browser-state convention to docs/effect-conventions.md (incl. the unstable-module adoption row and re-pin lockstep steps).
  • Adds a disposal regression test (runtime-document-atoms-disposal.test.ts, integration pool): 5 mount/unmount cycles with a never-resolving loader assert one abort per unmount; 5 resolving cycles assert re-render and bounded loader calls; zero page errors.
  • Patch changeset for agent-bundle (the Workbench dist ships inside the published package).

Bundle (workbench production build, rsbuild size table)

raw gzip
before (origin/main) 2646.2 kB 552.0 kB
after 2770.4 kB 595.3 kB
delta +124.2 kB (+4.7%) +43.3 kB (+7.8%)

The cost is the effect core + atom runtime entering the shared chunk (816.js 505.0 kB → 584.js 617.9 kB).

Test plan

  • pnpm typecheck and pnpm lint (0 errors/warnings)
  • pnpm test:unit (2330 passed, 0 failed)
  • Integration: runtime-inspector.test.ts + new runtime-document-atoms-disposal.test.ts (production bundle + real Chrome)
  • Workbench browser e2e at 1440×900: runtime-playground.e2e.test.ts (populated Document + decode-diagnostic flows) and overview.e2e.test.ts (populated + stale-diagnostic/repair flows) — 16/16 passed
  • All gates re-run after rebasing over chore: collapse literal Object.freeze pyramids into deepFreeze #238 and current main

Out of scope (phases 2–5, recorded on #105)

Route-editor state, project/capability graph, logs/evals stream pages, MCP controller.

…ct atoms under a root RegistryProvider (#105 phase 1)

Replaces RuntimeDocumentPanel's hand-rolled request union, AbortController,
and stale-run guards with an Atom.family keyed by run id consuming the
existing strictly-decoded agent-document-client output. Adds the Workbench
browser-state convention to docs/effect-conventions.md, a disposal
regression test (mount/unmount cycles interrupt in-flight loads and leak no
subscriptions), and exact pins effect@4.0.0-rc.112 /
@effect/atom-react@4.0.0-rc.112 / scheduler@0.27.0.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T00:29:24.236542Z 34a1216 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 34a1216

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-bundle Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@250
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@250
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@250

commit: 34a1216

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34a12163ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

export const agentDocumentLoaderAtom = Atom.make<AgentDocumentLoader | undefined>(undefined);

export const agentDocumentEventsAtom = Atom.family((runId: string) => Atom.make((get) => {
const loader = get.once(agentDocumentLoaderAtom);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Invalidate document atoms when the loader changes

When a mounted RuntimeInspector receives a replacement loadDocumentEvents callback while displaying the same run, useAgentDocumentLoader updates the loader atom, but get.once establishes no dependency and the family is keyed only by runId. Because loaderReady also remains true whenever any previous loader exists, the result atom stays mounted and continues using the old client/request or cached result indefinitely; this regresses the previous effect, which reloaded whenever loadDocumentEvents changed. Include the loader identity in the atom lifecycle or unmount/refresh the result atom during loader replacement.

Useful? React with 👍 / 👎.

@ScriptedAlchemy
ScriptedAlchemy merged commit 4d84f84 into main Sep 2, 2026
9 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the feat/workbench-atom-pilot branch September 3, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant